package cn.zwx.multi_datasource_example.service.db2.service;

import cn.zwx.multi_datasource_example.annotation.DataSource;
import cn.zwx.multi_datasource_example.mapper.db1.DataSynMapper;
import cn.zwx.multi_datasource_example.mapper.db2.OrderMapper;
import cn.zwx.multi_datasource_example.model.po.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @description:
 * @projectName:multi_datasource_example
 * @see:cn.zwx.multi_datasource_example.service.db2.service
 * @author:zhangwenxue
 * @createTime:2021/8/16 19:06
 * @version:1.0
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    @DataSource(name = "db2")
    public void insert(Order order) {
        orderMapper.insertSelective(order);
    }
}
